package com.gupt.youhd.controller;/*
@author name
@data 2023/4/22-14:22
*/

import com.gupt.youhd.common.R;
import com.gupt.youhd.qo.RegisterQo;
import com.gupt.youhd.service.RegisterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/register")
public class RegisterController {

    @Autowired
    private RegisterService registerService;


    @GetMapping("getCaptcha")  //生成验证码并返回给前端
    public R<Map> getCaptcha(String userName){

        Map<String, String> map = registerService.getCaptcha(userName);

        return R.success(map);
    }

    @PostMapping
    public R<String> register(@RequestBody  RegisterQo qo){

        String registerMsg = registerService.register(qo);

        return R.success(registerMsg);
    }
}
